﻿@using Infrastructure.Web;
@{
    Layout = null;

}

<!DOCTYPE html>

<html>
<head>
    @*<meta name="viewport" content="width=device-width" />*@
    <title>信息管理系统</title>
    <link href="~/Content/newui/css/common.css" rel="stylesheet" />
    <link href="~/Content/newui/css/style.css" rel="stylesheet" />
</head>
<body>
    <div class="login-box">
        <img class="bj" src="~/Content/newui/img/login-bj.jpg" alt="背景图">
        <div class="input-box">
            <div class="logo"><img src="~/Content/newui/img/login.png" alt="logo"></div>
            <div class="title">信息管理系统</div>
            <div class="input-container">
                <p>
                    <input class="name" type="text" id="UserName" placeholder="请输入用户名" value="@WebHelper.GetCookie("UserName")">
                </p>
                <p>
                    <input class="password" type="password" id="Password" placeholder="请输入密码" value="@WebHelper.GetCookie("Password")">
                </p>
                <p class="check">
                    <input class="checkbox" type="checkbox" name="IsRemeber" value="1" id="IsRemeber"><label for="checkbox">&nbsp;&nbsp;记住我</label>
                </p>
                <p class="submit-box">
                    <input class="submit" type="button" value="登录" id="login-button">
                </p>
            </div>
        </div>
    </div>
</body>
</html>
<script src="~/Content/newui/js/jquery-2.1.4.min.js"></script>
<script src="~/Content/newui/js/layout.js"></script>
<script src="~/Content/layer/layer.js"></script>
<script type="text/javascript">
    function loginModel() {
        return {
            UserName: $("#UserName").val(),
            Password: $("#Password").val(),
            IsRemeber: document.getElementsByName("IsRemeber")[0].checked
        }
    }
    $(function () {
        $("body").keydown(function () {
            if (event.keyCode == "13") {//keyCode=13是回车键
                $('#login-button').click();
            };
        });
        $('#login-button').click(function () {
            if ($("#UserName").val() == "" || $("#Password").val() == "") {
                layer.msg("用户名或密码不能为空");
                return;
            }
            $.post("/Home/LoginAjax", loginModel(), function (data) {
                if (data.state == 1) {

                    top.location.href = "/Home/NewView";
                }
                else {
                    layer.msg(data.message);
                }

            });

        });

    })

</script>